package docx;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.OutputStream;

import org.docx4j.Docx4J;
import org.docx4j.convert.in.Doc;
import org.docx4j.convert.out.HTMLSettings;
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;

public class doc2docx {
	public static void main(String[] args) throws FileNotFoundException, Exception{
		Doc doc = new Doc();
		String dir = System.getProperty("user.dir");
		String inputfilepath = "/sample-docs/haf_uebung2.doc" ;
		WordprocessingMLPackage wordMLPackage = doc.convert(new FileInputStream(dir + inputfilepath));
		wordMLPackage.save(new java.io.File(dir + "/DocxToXhtmlAndBack.docx"));
		
		
	/*	// XHTML export
				HTMLSettings htmlSettings = new HTMLSettings();
				htmlSettings.setWmlPackage(wordMLPackage);
				htmlSettings.setImageDirPath(dir + inputfilepath + "_files");
				htmlSettings.setImageTargetUri(inputfilepath + "_files");
				
				String htmlFilePath = dir + "/DocxToXhtml.html";
				
				OutputStream os = new java.io.FileOutputStream(htmlFilePath);
				
				Docx4J.toHTML(htmlSettings, os, Docx4J.FLAG_NONE);*/
		
		
	}

}
